#ifndef LOD_MENU_H
#define LOD_MENU_H

#include <string>
#include <GL/gl.h>

#define actMenuPosColorR 0.1f
#define actMenuPosColorG 1.0f
#define actMenuPosColorB 0.4f

#define menuPosColorR 1.0f
#define menuPosColorG 1.0f
#define menuPosColorB 1.0f

#define origObjColorR 0.4f
#define origObjColorG 0.81f
#define origObjColorB 0.61f

#define vboOrigObjColorR 1.0f
#define vboOrigObjColorG 0.81f
#define vboOrigObjColorB 0.41f

#define activeObjColorR 0.8f
#define activeObjColorG 0.5f
#define activeObjColorB 0.9f

#define origObjRotOf1Pixel 3
#define objMoveOf1Pixel 0.02f
#define objZoomOf1Pixel 0.005f

// LOD details (triangles,vertices)
#define visibleLODColorR 0.2f
#define visibleLODColorG 0.2f
#define visibleLODColorB 0.9f

// LOD details (triangles,vertices)
#define invisibleLODColorR menuPosColorR
#define invisibleLODColorG menuPosColorG
#define invisibleLODColorB menuPosColorB

#define helpTextMenuColorR 0.1f
#define helpTextMenuColorG 1.0f
#define helpTextMenuColorB 0.4f


struct main_menu_positions
{
   enum {
      load_and_show=1,
      generate,
      performanceTest,
      quit
   };

   static const int pos_count=4;
};

struct generateLODScreen_positions
{
   enum {
      load_obj=1,
      save_obj,
      alg_type,
      gen_params,
      from_level,
      to_level,
      generate,
      del
   };

   static const int pos_count=8;
};

struct lod_alg_type
{
   enum {
      dispersed_cubes=0,
      random,
      angle
   };

   struct disp_cubes_opts {
      enum {
         triangles=1,
         edge_collapse_type
      };
      static const int count=2;

      struct edge_coll_type {
         enum {
            half=0,
            full
         };

         static const char* names[];
         static const int count=2;
      };
   };
   
   static const char* names[];
   static const int count=3;
};

struct displayed_screen
{
   enum
   {
      mainScreen=0,
      loadAndShowScreen,
      generateLODScreen,
      testScreen,
   };
};




inline void setMenuColor()
{
    glColor3f(menuPosColorR, menuPosColorG, menuPosColorB);
}

inline void setActMenuColor()
{
    glColor3f(actMenuPosColorR, actMenuPosColorG, actMenuPosColorB);
}

inline void setOrigObjColor()
{
   glColor3f(origObjColorR, origObjColorG, origObjColorB);
}

inline void setVboOrigObjColor()
{
   glColor3f(vboOrigObjColorR, vboOrigObjColorG, vboOrigObjColorB);
}

inline void setVisibleLODColor()
{
   glColor3f(visibleLODColorR, visibleLODColorG, visibleLODColorB);
}

inline void setInvisibleLODColor()
{
   glColor3f(invisibleLODColorR, invisibleLODColorG, invisibleLODColorB);
}

inline void setActiveObjColor()
{
   glColor3f(activeObjColorR, activeObjColorG, activeObjColorB);
}

inline void setHelpTextColor()
{
   glColor3f(helpTextMenuColorR, helpTextMenuColorG, helpTextMenuColorB);
}


void display_main_menu(int width, int height, int chosenpos);
void main_menu_keyboard(unsigned char key, int x, int y,int& actMenuPos);
void display_generateLODScreen(int width, int height, int chosenpos);
int generateLODScreen_keyboard(unsigned char key, int x, int y, int& actMenuPos);
void generateLODScreen_mouse(int button, int state, int x, int y);
void generateLODScreen_mouse_motion(int x, int y);

#endif
